
package org.jetnuke.modules.pictures;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.velocity.VelocityContext;
import org.jetnuke.common.ActionForward;
import org.jetnuke.common.IAction;
import org.jetnuke.common.IAdminInfo;
import org.jetnuke.common.IModuleInfo;
import org.jetnuke.common.IUserInfo;
import org.jetnuke.modules.pictures.utils.PictureUtils;
import org.jetnuke.util.JetUtil;

public class AcceptLicense implements IAction {
	int check_accept;
	public void setCheck_accept(int check_accept) {
		this.check_accept = check_accept;
	}
	public ActionForward exec(HttpServletRequest request,
			HttpServletResponse response, VelocityContext vc, IModuleInfo info,
			String op, IUserInfo ui, IAdminInfo ai) throws Exception {
		if(ui==null || ui.getID()<2)
			return null;
		if(check_accept==1){
			PictureUtils.initializePictures(ui.getID());
			JetUtil.redirect(vc,response,request.getContextPath()+"/do/pictures/user?id="+ui.getID());
			return null;
		}
		JetUtil.redirect(vc,response,request.getContextPath()+"/do/your_account");
		return null;
	}

}
